const ID_TOKEN_KEY = "id_token";

/**
 * 获得token
 */
export const getToken = () => {
    const token = window.localStorage.getItem(ID_TOKEN_KEY);
    if(token == "undefined"){
        return null;
    }else {
        return token;
    }
}

/**
 * 保存token
 */
export const saveToken = (token) => {
    token && window.localStorage.setItem(ID_TOKEN_KEY, token);
}

/**
 * 删除token
 */
export const destroyToken = () => window.localStorage.removeItem(ID_TOKEN_KEY);